//
//  RYPaySuccessAlert.swift
//  SheYangBigData
//
//  Created by 宋海胜 on 2021/1/14.
//  Copyright © 2021 叁拾叁. All rights reserved.
//



import UIKit

class RYPaySuccessAlert: SYBaseView {

    var bgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = UIColor.white
        v.layer.cornerRadius = 5
        return v
    }()
    
    let back: UIButton = {
        let v: UIButton  = UIButton()
        v.backgroundColor = UIColor.clear
        return v
    }()
    
    let pic: UIImageView = {
        let v: UIImageView = UIImageView()
        v.image = UIImage(named: "yuyue_success")
        v.layer.cornerRadius = 3
        return v
    }()
    
    let titleLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 18.autoFontSize()
        v.text = "支付成功"
        return v
    }()
    
    let contentLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x999999)
        v.font = 13.autoFontSize()
        v.text = "请前往订单中心查看认养进度"
        v.numberOfLines = 0
        v.textAlignment = .center
        return v
    }()
    
    let sure: UIButton = {
        let v: UIButton  = UIButton()
        v.setTitle("确定", for: .normal)
        v.setTitleColor(UIColor(hex: 0x367FF6), for: .normal)
        v.titleLabel?.font = 18.autoFontSize()
        
        return v
    }()

    override func initViews() {
        
        
        sure.addTarget(self, action: #selector(backAction), for: .touchUpInside)
        back.addTarget(self, action: #selector(backAction), for: .touchUpInside)
        self.backgroundColor = UIColor(white: 0, alpha: 0.5)
        addSubview(back)
        addSubview(bgView)
        bgView.addSubview(pic)
        bgView.addSubview(titleLb)
        bgView.addSubview(contentLb)
        bgView.addSubview(sure)
        bgView.addSubview(lineView)
        back.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }
        bgView.snp.makeConstraints { (make) in
            make.center.equalToSuperview()
            make.width.equalTo(280.0.autoWidth())
            make.height.equalTo(200.0.autoWidth())
        }
        pic.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(19.0.autoWidth())
            make.centerX.equalToSuperview()
            make.width.height.equalTo(47.0.autoWidth())
        }
        titleLb.snp.makeConstraints { (make) in
            make.top.equalTo(pic.snp.bottom).offset(6.5.autoWidth())
            make.centerX.equalToSuperview()
            make.height.equalTo(17.0.autoWidth())
        }
        contentLb.snp.makeConstraints { (make) in
            make.top.equalTo(titleLb.snp.bottom).offset(14.5.autoWidth())
            make.centerX.equalToSuperview()
            make.height.equalTo(31.0.autoWidth())
            make.left.equalToSuperview().offset(37.5.autoWidth())
            make.right.equalToSuperview().offset(-37.5.autoWidth())
        }
        sure.snp.makeConstraints { (make) in
            make.top.equalTo(lineView.snp.bottom)
            make.centerX.equalToSuperview()
            make.left.right.equalToSuperview()
            make.height.equalTo(48.0.autoWidth())
        }
        lineView.snp.makeConstraints { (make) in
            make.top.equalTo(contentLb.snp.bottom).offset(16.0.autoWidth())
            make.left.right.equalToSuperview()
            make.height.equalTo(0.5.autoWidth())
        }
    }
    
    @objc func backAction() {
        self.isHidden = true
    }
}
